package com.xyongfeng.foodManagement.mapper;

import com.xyongfeng.foodManagement.domain.AdminInfo;
import com.xyongfeng.foodManagement.domain.Permission;
import com.xyongfeng.foodManagement.domain.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xyongfeng.foodManagement.domain.dto.RoleDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author xyongfeng
* @description 针对表【role】的数据库操作Mapper
* @createDate 2024-06-10 13:53:47
* @Entity generator.domain.Role
*/
public interface RoleMapper extends BaseMapper<Role> {

    @Select("SELECT r.* FROM t_role r,t_admin_role ar WHERE ar.admin_id = #{adminId} AND ar.role_id = r.role_id;")
    List<Role> getRoleByAdminId(@Param("adminId") Integer adminId);


    @Select("SELECT a.* FROM t_role r,t_admin_role ar,t_admin_info a WHERE a.admin_id = ar.admin_id AND ar.role_id = r.role_id AND r.role_id = #{adminId};")
    List<AdminInfo> selectAdminByRoleId(@Param("adminId")Integer adminId);

//    Boolean updateRole(RoleDTO roleDTO);
}




